<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
     <!-- 引入vue -->
     <script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>
   
    <div id="root">
        <p v-if="seen">现在你看到我了</p>
        <ol>
            <li v-for="todo in todos">
              {{ todo.text }}
            </li>
          </ol>
          <p>{{ message }}</p>
          <button v-on:click="reverseMessage">反转消息</button>
    </div>
    
</body>
<script type="text/javascript">
    Vue.config.productionTip = false //阻止vue在启动生成生产提示。

    new Vue({
        el:'#root',
        data:{
            seen:true,
            todos: [
               { text: '学习 JavaScript' },
               { text: '学习 Vue' },
               { text: '整个牛项目' }
            ],
            message: 'Hello Vue.js!',
        },
        methods: {
           reverseMessage: function () {
           this.message = this.message.split('').reverse().join('')
           }
        }
    })
    </script>
</html>